import Vue from 'vue'
import Vuex from 'vuex'
// 引入vuex持久化
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  // 数据持久化
  plugins: [createPersistedState()],
  state: {
    cityName: '北京',
    cityId: '110100',
    // 登陆状态
    isLogin: false,
    // 用户是否已经自己选择城市
    isSelectCity: false,
  },
  mutations: {
    changeCityName(state, value) {
      state.cityName = value
    },
    changeCityId(state, value) {
      state.cityId = value
    },
    changeLogin(state, value) {
      state.isLogin = value
    },
    changeSelectCity(state, value) {
      state.isSelectCity = value
    }
  },
  getters: {

  },
  actions: {

  },
  modules: {
    
  }
})
